package com.northwest_man;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Random;

public class Test {
    public static void main(String[] args) {
        /*List<Product> productList = generateProductList(3);
        String jsonString = new Gson().toJson(productList);
        System.out.println(jsonString);*/
        final File classesDir = new File("D:\\Users\\Desktop\\O_RaimoGeneratedClasses");
        final File dexOutputDir = new File("D:\\Projects\\oraimo-android\\app\\build\\intermediates\\classes\\release\\transformReleaseClassesWithAsm\\dirs");
        final File dexOutputDir_2 = new File("D:\\Projects\\oraimo-android\\app\\build\\intermediates\\classes\\debug\\transformDebugClassesWithAsm\\dirs");

        final Collection<File> files = FileUtils.listFiles(classesDir, null, true);
        for (final File file : files) {
            final String absPath = file.getAbsolutePath();
            final String endPart = absPath.substring(classesDir.getAbsolutePath().length());

            System.out.printf("%s | %s%n", absPath, endPart);
            final File newFile1 = new File(dexOutputDir, endPart);
            final File newFile2 = new File(dexOutputDir_2, endPart);

            try {
                FileUtils.copyFile(file, newFile1);
                FileUtils.copyFile(file, newFile2);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

        }

    }

    private static List<Product> generateProductList(int length) {
        List<Product> productList = new ArrayList<>();

        for (int i = 0; i < length; i++) {
            Product product = new Product();
            product.setProduct_group_id(generateRandomString());
            product.setProduct_id(generateRandomString());
            product.setSku(generateRandomString());
            product.setEan(generateRandomString());
            product.setMain_image(generateRandomString());
            product.setMain_thumb_image(generateRandomString());
            product.setFull_title(generateRandomString());
            product.setMain_title(generateRandomString());
            product.setSub_title(generateRandomString());
            product.setMarket_price(generateRandomString());
            product.setShop_price(generateRandomString());
            product.setFinal_price(generateRandomString());
            product.setActive(generateRandomString());
            product.setQty(generateRandomString());
            product.setTime_remain(generateRandomString());
            product.setReview_qty(generateRandomString());
            product.setStar_level(generateRandomString());
            product.setDetail_url(generateRandomString());
            product.setAttribute(generateRandomString());
            product.setWeight(generateRandomString());
            product.setFlash_sale_id(generateRandomString());
            product.setSelling_point_label(generateRandomString());
            product.setPromotion_label(generateRandomString());
            product.setCategory_ids(generateRandomString());
            product.setTag_ids(generateRandomString());
            product.setPromotion_status(generateRandomString());
            product.setTimes(generateRandomString());
            product.setTrack_market_price(generateRandomString());
            product.setTrack_final_price(generateRandomString());

            productList.add(product);
        }

        return productList;
    }

    private static String generateRandomString() {
        // 生成随机字符串的逻辑，可以根据实际需求自定义
        String characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        StringBuilder sb = new StringBuilder();
        Random random = new Random();

        for (int i = 0; i < 10; i++) {
            int index = random.nextInt(characters.length());
            char randomChar = characters.charAt(index);
            sb.append(randomChar);
        }

        return sb.toString();
    }
}

class Product {
    public String product_group_id;
    public String product_id;
    public String sku;
    public String ean;
    public String main_image;
    public String main_thumb_image;
    public String full_title;
    public String main_title;
    public String sub_title;
    public String market_price;
    public String shop_price;
    public String final_price;
    public String active;
    public String qty;
    public String time_remain;
    public String review_qty;
    public String star_level;
    public String detail_url;
    public String attribute;
    public String weight;
    public String flash_sale_id;
    public String selling_point_label;
    public String promotion_label;
    public String category_ids;
    public String tag_ids;
    public String promotion_status;
    public String times;
    public String track_market_price;
    public String track_final_price;

    // getters and setters


    public String getProduct_group_id() {
        return product_group_id;
    }

    public void setProduct_group_id(String product_group_id) {
        this.product_group_id = product_group_id;
    }

    public String getProduct_id() {
        return product_id;
    }

    public void setProduct_id(String product_id) {
        this.product_id = product_id;
    }

    public String getSku() {
        return sku;
    }

    public void setSku(String sku) {
        this.sku = sku;
    }

    public String getEan() {
        return ean;
    }

    public void setEan(String ean) {
        this.ean = ean;
    }

    public String getMain_image() {
        return main_image;
    }

    public void setMain_image(String main_image) {
        this.main_image = main_image;
    }

    public String getMain_thumb_image() {
        return main_thumb_image;
    }

    public void setMain_thumb_image(String main_thumb_image) {
        this.main_thumb_image = main_thumb_image;
    }

    public String getFull_title() {
        return full_title;
    }

    public void setFull_title(String full_title) {
        this.full_title = full_title;
    }

    public String getMain_title() {
        return main_title;
    }

    public void setMain_title(String main_title) {
        this.main_title = main_title;
    }

    public String getSub_title() {
        return sub_title;
    }

    public void setSub_title(String sub_title) {
        this.sub_title = sub_title;
    }

    public String getMarket_price() {
        return market_price;
    }

    public void setMarket_price(String market_price) {
        this.market_price = market_price;
    }

    public String getShop_price() {
        return shop_price;
    }

    public void setShop_price(String shop_price) {
        this.shop_price = shop_price;
    }

    public String getFinal_price() {
        return final_price;
    }

    public void setFinal_price(String final_price) {
        this.final_price = final_price;
    }

    public String getActive() {
        return active;
    }

    public void setActive(String active) {
        this.active = active;
    }

    public String getQty() {
        return qty;
    }

    public void setQty(String qty) {
        this.qty = qty;
    }

    public String getTime_remain() {
        return time_remain;
    }

    public void setTime_remain(String time_remain) {
        this.time_remain = time_remain;
    }

    public String getReview_qty() {
        return review_qty;
    }

    public void setReview_qty(String review_qty) {
        this.review_qty = review_qty;
    }

    public String getStar_level() {
        return star_level;
    }

    public void setStar_level(String star_level) {
        this.star_level = star_level;
    }

    public String getDetail_url() {
        return detail_url;
    }

    public void setDetail_url(String detail_url) {
        this.detail_url = detail_url;
    }

    public String getAttribute() {
        return attribute;
    }

    public void setAttribute(String attribute) {
        this.attribute = attribute;
    }

    public String getWeight() {
        return weight;
    }

    public void setWeight(String weight) {
        this.weight = weight;
    }

    public String getFlash_sale_id() {
        return flash_sale_id;
    }

    public void setFlash_sale_id(String flash_sale_id) {
        this.flash_sale_id = flash_sale_id;
    }

    public String getSelling_point_label() {
        return selling_point_label;
    }

    public void setSelling_point_label(String selling_point_label) {
        this.selling_point_label = selling_point_label;
    }

    public String getPromotion_label() {
        return promotion_label;
    }

    public void setPromotion_label(String promotion_label) {
        this.promotion_label = promotion_label;
    }

    public String getCategory_ids() {
        return category_ids;
    }

    public void setCategory_ids(String category_ids) {
        this.category_ids = category_ids;
    }

    public String getTag_ids() {
        return tag_ids;
    }

    public void setTag_ids(String tag_ids) {
        this.tag_ids = tag_ids;
    }

    public String getPromotion_status() {
        return promotion_status;
    }

    public void setPromotion_status(String promotion_status) {
        this.promotion_status = promotion_status;
    }

    public String getTimes() {
        return times;
    }

    public void setTimes(String times) {
        this.times = times;
    }

    public String getTrack_market_price() {
        return track_market_price;
    }

    public void setTrack_market_price(String track_market_price) {
        this.track_market_price = track_market_price;
    }

    public String getTrack_final_price() {
        return track_final_price;
    }

    public void setTrack_final_price(String track_final_price) {
        this.track_final_price = track_final_price;
    }
}